package com.fbs.wowo.manage.mapper;

import com.fbs.wowo.manage.entity.AccountDetail;
import org.apache.ibatis.jdbc.SQL;

public class AccountDetailSqlProvider {

    public String insertSelective(AccountDetail record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("account_detail");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=VARCHAR}");
        }
        
        if (record.getUserId() != null) {
            sql.VALUES("user_id", "#{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getBankNum() != null) {
            sql.VALUES("bank_num", "#{bankNum,jdbcType=VARCHAR}");
        }
        
        if (record.getTel() != null) {
            sql.VALUES("tel", "#{tel,jdbcType=VARCHAR}");
        }
        
        if (record.getBankCode() != null) {
            sql.VALUES("bank_code", "#{bankCode,jdbcType=VARCHAR}");
        }

        if (record.getWxOpenId() != null) {
            sql.VALUES("wx_open_id", "#{wxOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getName() != null) {
            sql.VALUES("name", "#{name,jdbcType=VARCHAR}");
        }
        
        if (record.getIdNum() != null) {
            sql.VALUES("id_num", "#{idNum,jdbcType=VARCHAR}");
        }
        
        if (record.getCertType() != null) {
            sql.VALUES("cert_type", "#{certType,jdbcType=TINYINT}");
        }
        
        if (record.getFrontImg() != null) {
            sql.VALUES("front_img", "#{frontImg,jdbcType=VARCHAR}");
        }
        
        if (record.getContraryImg() != null) {
            sql.VALUES("contrary_img", "#{contraryImg,jdbcType=VARCHAR}");
        }
        
        if (record.getHandImg() != null) {
            sql.VALUES("hand_img", "#{handImg,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCompanyName() != null) {
            sql.VALUES("company_name", "#{companyName,jdbcType=VARCHAR}");
        }
        
        if (record.getCompanyCertType() != null) {
            sql.VALUES("company_cert_type", "#{companyCertType,jdbcType=TINYINT}");
        }
        
        if (record.getCompanyCertNum() != null) {
            sql.VALUES("company_cert_num", "#{companyCertNum,jdbcType=VARCHAR}");
        }
        
        if (record.getCompanyBlImg() != null) {
            sql.VALUES("company_bl_img", "#{companyBlImg,jdbcType=VARCHAR}");
        }
        
        if (record.getCompanyAttorneyImg() != null) {
            sql.VALUES("company_attorney_img", "#{companyAttorneyImg,jdbcType=VARCHAR}");
        }

        if (record.getType() != null) {
            sql.VALUES("type","#{type,jdbcType=VARCHAR}");
        }
        
        if (record.getCertStatus() != null) {
            sql.VALUES("cert_status", "#{certStatus,jdbcType=TINYINT}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(AccountDetail record) {
        SQL sql = new SQL();
        sql.UPDATE("account_detail");
        
        if (record.getUserId() != null) {
            sql.SET("user_id = #{userId,jdbcType=VARCHAR}");
        }
        
        if (record.getBankNum() != null) {
            sql.SET("bank_num = #{bankNum,jdbcType=VARCHAR}");
        }
        
        if (record.getTel() != null) {
            sql.SET("tel = #{tel,jdbcType=VARCHAR}");
        }
        
        if (record.getBankCode() != null) {
            sql.SET("bank_code = #{bankCode,jdbcType=VARCHAR}");
        }

        if (record.getWxOpenId() != null) {
            sql.SET("wx_open_id = #{wxOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getName() != null) {
            sql.SET("name = #{name,jdbcType=VARCHAR}");
        }
        
        if (record.getIdNum() != null) {
            sql.SET("id_num = #{idNum,jdbcType=VARCHAR}");
        }
        
        if (record.getCertType() != null) {
            sql.SET("cert_type = #{certType,jdbcType=TINYINT}");
        }
        
        if (record.getFrontImg() != null) {
            sql.SET("front_img = #{frontImg,jdbcType=VARCHAR}");
        }
        
        if (record.getContraryImg() != null) {
            sql.SET("contrary_img = #{contraryImg,jdbcType=VARCHAR}");
        }
        
        if (record.getHandImg() != null) {
            sql.SET("hand_img = #{handImg,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCompanyName() != null) {
            sql.SET("company_name = #{companyName,jdbcType=VARCHAR}");
        }
        
        if (record.getCompanyCertType() != null) {
            sql.SET("company_cert_type = #{companyCertType,jdbcType=TINYINT}");
        }
        
        if (record.getCompanyCertNum() != null) {
            sql.SET("company_cert_num = #{companyCertNum,jdbcType=VARCHAR}");
        }
        
        if (record.getCompanyBlImg() != null) {
            sql.SET("company_bl_img = #{companyBlImg,jdbcType=VARCHAR}");
        }
        
        if (record.getCompanyAttorneyImg() != null) {
            sql.SET("company_attorney_img = #{companyAttorneyImg,jdbcType=VARCHAR}");
        }
        
        if (record.getType() != null) {
            sql.SET("type = #{type,jdbcType=VARCHAR}");
        }
        
        if (record.getCertStatus() != null) {
            sql.SET("cert_status = #{certStatus,jdbcType=TINYINT}");
        }
        
        sql.WHERE("id = #{id,jdbcType=VARCHAR}");
        
        return sql.toString();
    }
}